home *** CD-ROM | disk | FTP | other *** search
- #include "stdafx.h"
- #include "appdocs.h"
-
- /////////////////
- // Send WM_NOTIFY to all docs
- //
- BOOL CAppDocs::SendNotify(UINT nID, int nCode, NMHDR* pNMHDR)
- {
- return SendCmdMsg(nID, MAKELONG(nCode, WM_NOTIFY), pNMHDR);
- }
-
- //////////////////
- // Send command to all docs
- //
- BOOL CAppDocs::SendCommand(UINT nID)
- {
- return SendCmdMsg(nID, CN_COMMAND, NULL);
- }
-
- //////////////////
- // Private helper sends either command or notification
- // Loop for all docs and call doc->OnCmdMsg
- //
- BOOL CAppDocs::SendCmdMsg(UINT nID, int nCode, void* pExtra)
- {
- BOOL bAnyHandled = FALSE;
- CPtrList& tempList = AfxGetApp()->m_templateList;
- POSITION pos1 = tempList.GetHeadPosition();
- while (pos1) {
- CDocTemplate* pTemplate=(CDocTemplate*)tempList.GetNext(pos1);
- POSITION pos2 = pTemplate->GetFirstDocPosition();
- while (pos2) {
- CDocument *pDoc = pTemplate->GetNextDoc(pos2);
- if (pDoc->OnCmdMsg(nID, nCode, pExtra, NULL))
- bAnyHandled=TRUE;
- }
- }
- return bAnyHandled;
- }
-